using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using BLL;

namespace WebUI.Carriers
{
    public partial class CustomCargo_List : BasicPage
    {
        private ICustomManager customManager;

        private ICarriersManager carriersManger;
        protected void Page_Load(object sender, EventArgs e)
        {
            customManager = BLLFactory.CreateCustomManager();
            carriersManger = BLLFactory.CreateCarriersManager();
            if (!IsPostBack)
            {
                Display();
            }
        }

        private void Display()
        {
            this.gvwCustomCargoList.DataSource = customManager.SelectCargo(null);
            this.gvwCustomCargoList.DataKeyNames = new string[] { "CustomCargoSN" };
            this.gvwCustomCargoList.DataBind();
        }

        protected void gvwCarriersList_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int cargoSn = 0;
            cargoSn = Int32.Parse(this.gvwCustomCargoList.DataKeys[e.RowIndex].Value.ToString());
            Response.Redirect("~/Carriers/Carriers_Modify.aspx?cargoSn="+cargoSn);
        }

        protected void gvwCustomCargoList_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            this.gvwCustomCargoList.PageIndex = e.NewPageIndex;
            Display();
        }
    }
}
